package user

import (
	"feng-che.com/server/driver-quiz/internal/constants"
	"go.mongodb.org/mongo-driver/bson"
	"go.mongodb.org/mongo-driver/bson/primitive"
)

// ConditionUserIsCoach 查找教练的条件
func ConditionUserIsCoach(yes bool) bson.E {
	if yes {
		return bson.E{Key: "person.role", Value: constants.Coach}
	}
	return bson.E{Key: "person.role", Value: bson.M{
		"$nin": bson.A{constants.Coach},
	}}
}

// ConditionInstitutionStaff 查找教练的条件
func ConditionInstitutionStaff() bson.E {
	return bson.E{Key: "is_institution_staff", Value: true}
}

func ConditionStaffOfSchool(schoolID *primitive.ObjectID) bson.E {
	return bson.E{Key: "school_id", Value: schoolID}
}
